//// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
//package com.linqingying.gitcode.api
//
//import git4idea.remote.hosting.HostedGitRepositoryConnection
//import kotlinx.coroutines.CoroutineScope
//import kotlinx.coroutines.Job
//import kotlinx.coroutines.cancelAndJoin
//import com.linqingying.gitcode.authentication.accounts.GitCodeAccount
//import com.linqingying.gitcode.pullrequest.data.GCPRDataContext
//import com.linqingying.gitcode.util.GCGitRepositoryMapping
//
//internal class GCRepositoryConnection(private val scope: CoroutineScope,
//                                      override val repo: GCGitRepositoryMapping,
//                                      override val account: GitCodeAccount,
//                                      val dataContext: GCPRDataContext)
//  : HostedGitRepositoryConnection<GCGitRepositoryMapping, GitCodeAccount> {
//
//  override suspend fun close() {
//    try {
//      (scope.coroutineContext[Job] ?: error("Missing job")).cancelAndJoin()
//    }
//    catch (_: Exception) {
//    }
//  }
//
//  override suspend fun awaitClose() {
//    try {
//      (scope.coroutineContext[Job] ?: error("Missing job")).join()
//    }
//    catch (_: Exception) {
//    }
//  }
//}
